let $ = layui.jquery;
let jQuery=$;
let SettingData = {};//配置文件参数
let SeleteData = {};//筛选参数
let current =1;
let raw = '';//排序
let InitData={};
let table_config = {
    "header": {
        "button": [],
        "tab": [
            {name:"登录日志",current:1},
            {name:"操作日志",current:2},
        ],
        "search": {
            "datetime": [
                {
                    "value": "create_time",
                    "label": "操作时间"
                }
            ],
            "like": "模块|控制器|方法|ip地址|IP详细地址"
        },
        "sum": []
    },
    "left": {
        "status": 2,
        "title": null,
        "options_id": null,
        "key_field": "value",
        "show_field": "label",
        "field": null,
        "type": 1,
        "url": {
            "title": "",
            "list": "/common/options/leftlists/?num=",
            "add": "",
            "edit": "",
            "delete": "",
            "width": "",
            "height": ""
        }
    },
    "source": "log_type",
    "table": {
        "button": [],
        "style": 1,
        "parent_id": "parent_id",
        "parent_name": "title",
        "limit": 30,
        "tab_sum": "/admin/info/tabsum/",
        "page": true,
        "elem": "datatable",
        "height": "full-130",
        "update": "",
        "url": "/admin/info/log/",
        "cols": [
            {
                "id": "1713717304_18_1",
                "tpl": "",
                "align": "",
                "field": "type",
                "group": "",
                "title": "日志类别",
                "search": "select",
                "update": "",
                "options": "log_type",
                "show_rule": [
                    {
                        "rule_type": "tab",
                        "event_type": "in",
                        "value": "2"
                    }
                ]
            },
            {
                "id": "1713717304_18_2",
                "field": "module",
                "group": "",
                "title": "模块"
            },
            {
                "id": "1713717305_18_3",
                "field": "controller",
                "group": "",
                "title": "控制器"
            },
            {
                "id": "1713717306_18_4",
                "field": "action",
                "group": "",
                "title": "方法"
            },
            {
                "id": "1713717449_18_9",
                "field": "ip",
                "title": "ip地址"
            },
            {
                "id": "1723442818_13_8",
                "tpl": "",
                "field": "ip_address",
                "title": "IP详细地址",
                "show_rule": [
                    {
                        "rule_type": "tab",
                        "event_type": "in",
                        "value": "1"
                    }
                ]
            },
            {
                "id": "1713717306_18_5",
                "field": "method",
                "title": "请求方式"
            },
            {
                "id": "1713717314_18_7",
                "field": "create_id",
                "title": "操作人"
            },
            {
                "id": "1713717315_18_8",
                "field": "create_time",
                "title": "操作时间",
                "width": "160",
                "minWidth": "160"
            }
        ]
    }
};
let form_config = {
    detail:'/admin/info/detail/',
    add:'',
    edit:'/admin/info/edit/',
    data:{},
    label_width:'',
    form_label:'form_top',
    onclick:[],
};


layui.use(['engine_table', 'http', 'public','form','engine_form'], function () {
    current = layui.public.GetQuery('current') || 1;
    onLoad();
})

function onLoad() {
    layui.engine_table.TableLoadBack();
    let LoadData=layui.engine_form.LoadData();
    layui.http.SendAjax(LoadData.PostUrl, LoadData.PostData, [], function (res) {
        layui.engine_form.LoadBack(res,'form_body_data','form_body');
    })


}
function SearchLoad(elem = '', type = '') {
    layui.engine_table.SearchLoad(elem, type);
}

function SendForm() {
    let SendData = layui.engine_form.SendData();
    layui.http.SendAjax(SendData.PostUrl, SendData.PostData, [], function (res) {
        layui.engine_form.SendBack(res);
    })
}

function FormBind()
{
    layui.engine_form.BindUpload('6ced_1721960027588_39408','','upimg','','','1');
    layui.engine_form.BindSelect('6a4f_1718182133690_28448','cascader','role_ids','admin_role',1,);
    layui.engine_form.BindSelect('59db_1713364717418_84771','cascader','department_ids','department_list',1,);
}


function init() {
    onLoad();
}
